package com.group6.exam.common.entity;

import java.util.List;

public class PageModel {

	private int pageSize = 5;
	private int currentPage = 1;
	private int totalRecords;
	private int pageTotal;
	private List<?> list;

	// 扩展的属性
	private String roleId;
	private String subjectId;
	private String userId;

	public String getSubjectId() {
		return subjectId;
	}

	public void setSubjectId(String subjectId) {
		this.subjectId = subjectId;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	public PageModel() {
		super();
	}

	public PageModel(int pageSize, int currentPage, int totalRecords,
			List<?> list) {
		super();
		this.pageSize = pageSize;
		this.currentPage = currentPage;
		this.totalRecords = totalRecords;
		this.list = list;
	}

	/**
	 * 计算总页数
	 * 
	 * @param pageSize
	 * @param totalRecords
	 */
	public PageModel(int totalRecords, int pageSize) {
		this.pageTotal = (int) Math.ceil((double) totalRecords / pageSize);
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getTotalRecords() {
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}

	public int getPageTotal() {
		return pageTotal;
	}

	public void setPageTotal(int pageTotal) {
		this.pageTotal = pageTotal;
	}

	public List<?> getList() {
		return list;
	}

	public void setList(List<?> list) {
		this.list = list;
	}

}
